Skip to content

Conversation

@ym
Copy link
Contributor

@ym ym commented Apr 10, 2025

react-use-websocket' sends a ping' message instead of the control frame defined in RFC6455, as sending the opcode is currently not supported by some browsers.

This PR adds support for ping messages and logging.

@ym ym requested review from adamshiervani and Copilot April 10, 2025 10:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • go.mod: Language not supported

logInfof("ping message received: %s", string(msg))
err = wsCon.Write(context.Background(), websocket.MessageText, pongMessage)
if err != nil {
logWarnf("unable to write pong message: %v", err)
Copy link

Copilot AI Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error during pong message write may abruptly terminate the connection if encountered. Consider handling the error more gracefully (e.g., logging the error and possibly attempting a retry or closing the connection in a controlled manner).

Suggested change
logWarnf("unable to write pong message: %v", err)
logWarnf("unable to write pong message: %v", err)
closeErr := wsCon.Close(websocket.StatusInternalError, "error writing pong message")
if closeErr != nil {
logWarnf("error closing websocket connection: %v", closeErr)
}

Copilot uses AI. Check for mistakes.
@adamshiervani adamshiervani merged commit 4137b82 into jetkvm:dev Apr 10, 2025
2 checks passed
ym added a commit to ym/jetkvm-kvm that referenced this pull request Jun 13, 2025
ym added a commit to ym/jetkvm-kvm that referenced this pull request Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants